// Copyright (c)  YISH. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using NSQL.Sharpen;

namespace NSQL.Expressions.Functions
{
    public class RankFunction : BaseExpression, IRankFunction
    {
        public INumericExpression Expr { get; set; }
        public Order Order { get; set; }
        public bool IsDense { get; set; } = false;

        public RankFunction(INumericExpression expression, Order order)
        {
            Expr = expression;
            Order = order;
        }
        public RankFunction(INumericExpression expression, bool isDense, Order order)
        {
            Expr = expression;
            Order = order;
            IsDense = isDense;
        }

        public override T Accept<T>(IExpressionVisitor<T> visitor) => visitor.Visit(this);

        public override void Accept(IExpressionVisitor visitor) => visitor.Visit(this);

        public override bool IsValid => Expr.IsValid;
        protected override IExpression DeepCopy()
        {
            return new RankFunction(Expr.DeepClone(), Order)
            {
                Tag = Tag
            };
        }

    }
}